package org.jeecg.modules.mall.api.user.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.mall.service.ITbMnUserService;
import org.jeecg.modules.mall.service.TestupGradeData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * <p>
 * 描述
 * </p>
 */
@Slf4j
@Api(tags = "app淘宝")
@RestController
@RequestMapping("/user/app/api")
public class AppLoginController {

    @Autowired
    private ITbMnUserService tbMnUserService;


    @Autowired
    private TestupGradeData testupGradeData;

    @AutoLog(value = "App前端登陆-app用户登陆")
    @ApiOperation("app用户登陆")
    @PostMapping(value = "/loginByInviteCode")
    public Result<?> loginByInviteCode(String phone, String inviteCode) {
        return tbMnUserService.loginByInviteCode(phone, inviteCode);

    }

    @AutoLog(value = "App前端登陆-校验验证码")
    @ApiOperation("校验验证码")
    @PostMapping(value = "/checkCode")
    public Result<?> checkCode(String phone, String code) {
        return tbMnUserService.checkCode(phone, code);

    }


    @AutoLog(value = "App前端登陆-发送短信")
    @ApiOperation(value="App前端登陆-发送短信", notes="App前端登陆-发送短信")
    @ApiImplicitParam(name = "phone",value = "电话号码",required = true,dataType = "String")
    @PostMapping(value = "/sendSMS")
    public Result<?> sendSMS(@RequestParam String phone) {
        return tbMnUserService.sendSms(phone);
    }

    @AutoLog(value = "App前端登陆-app用户登陆")
    @ApiOperation("app用户登陆")
    @PostMapping(value = "/appRegister")
    public Result<?> appRegister(String phone, String inviteCode,String code) {

        return tbMnUserService.appRegister(phone, inviteCode,code);

    }

    @AutoLog(value = "测试淘宝升级")
    @ApiOperation("测试淘宝升级")
    @PostMapping(value = "/testupGrade")
    public Result<?> testupGrade(String trade_id) {

     //   TestupGradeData testupGradeData=new TestupGradeData();
     //1055359811118902326
        testupGradeData.test(trade_id);
        return Result.ok("测试完成");

    }


}
